﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ForzaGT3.Data
{
    public partial class NewsletterSubscriber
    {
        public void Insert()
        {
            DataRepositoryFactory.CurrentRepository
                .Create<NewsletterSubscriber>(this);
        }

        public void Update()
        {
            DataRepositoryFactory.CurrentRepository
                .Modify<NewsletterSubscriber>(this);
        }

        public void Delete()
        {
            DataRepositoryFactory.CurrentRepository
                .Delete<NewsletterSubscriber>(this);
        }

        public static NewsletterSubscriber GetById(Guid Id)
        {
            return DataRepositoryFactory.CurrentRepository
                .Single<NewsletterSubscriber>(x => x.SubscriberId == Id);
        }

        public static IEnumerable<NewsletterSubscriber> GetAll()
        {
            return DataRepositoryFactory.CurrentRepository
                .GetAll<NewsletterSubscriber>();
        }
    }
}
